package com.example.sprintboot.entity;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

public enum Role {
    BUYER("buyer"),
    SELLER("seller"),
    ADMIN("admin");

    @EnumValue  // 标记：MyBatis 持久化时使用该值
    private final String code;

    // 构造方法：绑定枚举与数据库存储值
    Role(String code) {
        this.code = code;
    }

    @JsonValue
    public String getCode() {
        return code;
    }
}